package cn.tradewin.pmp.mixins;

import org.apache.tapestry5.ClientElement;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.InjectContainer;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.json.JSONObject;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;

public class updateDialog {

//	@Parameter(name = "clientEvent", defaultPrefix = BindingConstants.LITERAL)
//    private String clientEvent;
//
//    @Parameter(name = "event", defaultPrefix = BindingConstants.LITERAL, required = true)
//    private String event;
//
//    @Parameter(name = "prefix", defaultPrefix = BindingConstants.LITERAL, value = "default")
//    private String prefix;
//
//    @Parameter(name = "context")
//    private Object[] context;
//
//    @Parameter(name = "zone", defaultPrefix = BindingConstants.LITERAL, required = true)
//    private String zone;
//
    @Inject
    private ComponentResources componentResources;

    @Environmental
    private JavaScriptSupport javaScriptSupport;

    @InjectContainer
    private ClientElement clientElement;

    // The code

    void afterRender() {
        JSONObject spec = new JSONObject();
        spec.put("id", "#myModal");
        javaScriptSupport.require("updateDialog").invoke("init").with(spec);
    }	
}
